Skip to content

Enable health check to use mtls to connect to backends#807

Closed
felicity3786 wants to merge 3 commits into
trinodb:mainfrom
felicity3786:felicity3786/mtls-healthcheck
Closed

Enable health check to use mtls to connect to backends#807
felicity3786 wants to merge 3 commits into
trinodb:mainfrom
felicity3786:felicity3786/mtls-healthcheck

Conversation

@felicity3786
Copy link
Copy Markdown
Contributor

Description

Today, Trino Gateway’s health monitors authenticate to backend clusters using either:

Authorization: Basic header (username/password), or X-Trino-User header (when no password is configured)

This creates operational burdens for deployments that must rotate or manage shared credentials, and it exposes unnecessary authentication material in gateway configs.
This PR introduces optional mTLS-based authentication for health checks, allowing deployments to rely solely on client certificates when connecting to backend JMX or metrics endpoints.

backendState.monitorMtlsEnabled: true/false
When monitorMtlsEnabled=true, the health monitors switch to certificate-based auth and no longer send any identity headers. Startup validation for TLS required configuration is also added.
If monitorMtlsEnabled is false (default), existing behavior is unchanged, provides the backward compatibility.

Test

Build passed.
Tested with local gateway the health check is working as expected.

Additional context and related issues

NA

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required, with the following suggested text:

* Fix some things.

@cla-bot cla-bot Bot added the cla-signed label Dec 12, 2025
Comment on lines +145 to +146
MONITOR_HTTP_CLIENT_TRUST_STORE_PATH,
MONITOR_HTTP_CLIENT_TRUST_STORE_PASSWORD
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A user could skip setting truststore. Airlift would fallback to some system default truststore.

}
else {
identityHeader = new Header("X-Trino-User", backendStateConfiguration.getUsername());
identityHeader = null;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Optional instead of null.

Comment on lines +85 to +89
private static final String MONITOR_HTTP_CLIENT_KEY_STORE_PATH = "monitor.http-client.key-store-path";
private static final String MONITOR_HTTP_CLIENT_KEY_STORE_PASSWORD = "monitor.http-client.key-store-password";
private static final String MONITOR_HTTP_CLIENT_TRUST_STORE_PATH = "monitor.http-client.trust-store-path";
private static final String MONITOR_HTTP_CLIENT_TRUST_STORE_PASSWORD = "monitor.http-client.trust-store-password";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I was thinking of something like this, WDYT?

Suggested change
private static final String MONITOR_HTTP_CLIENT_KEY_STORE_PATH = "monitor.http-client.key-store-path";
private static final String MONITOR_HTTP_CLIENT_KEY_STORE_PASSWORD = "monitor.http-client.key-store-password";
private static final String MONITOR_HTTP_CLIENT_TRUST_STORE_PATH = "monitor.http-client.trust-store-path";
private static final String MONITOR_HTTP_CLIENT_TRUST_STORE_PASSWORD = "monitor.http-client.trust-store-password";
private static final List<String> REQUIRED_MONITOR_MTLS_KEYS = List.of(
"monitor.http-client.key-store-path",
"monitor.http-client.key-store-password",
"monitor.http-client.trust-store-path",
"monitor.http-client.trust-store-password");

@github-actions
Copy link
Copy Markdown

This pull request has gone a while without any activity. Ask for help on #trino-gateway-dev on Trino slack.

@github-actions github-actions Bot added the stale label Jan 27, 2026
@github-actions
Copy link
Copy Markdown

Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time.

@github-actions github-actions Bot closed this Feb 17, 2026
@mosabua
Copy link
Copy Markdown
Member

mosabua commented Feb 18, 2026

I think this PR still provides a useful feature. What do you think @felicity3786 @oneonestar .. if yes we should reopen and continue work on it ideally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants